#include "send_command.hpp"

Send_Command::Send_Command(const char* ip_server,unsigned int port_server,unsigned int port_communication,string password):socket(ip_server,port_server,port_communication),password(password)
{
  for(int c=0 ; c < 4 ; ++c)
    prefix+=(char)0xFF;

  prefix+="rcon "+password+" ";
}

void Send_Command::send_bigtext(const string texte)
{
  string cmd(prefix);

  cmd+="bigtext \""+texte+"\"";
  socket.send_data(cmd);
}

void Send_Command::send_message(const string message)
{
  string cmd(prefix);

  cmd+=message;
  socket.send_data(cmd);
}

void Send_Command::send_slap(const string id)
{
  string cmd(prefix);

  cmd+="slap "+id;
  socket.send_data(cmd);
}

void Send_Command::send_kick(const string id)
{
  string cmd(prefix);

  cmd+="clientkick "+id;
  socket.send_data(cmd);
}

void Send_Command::send_nuke(const string id)
{
  string cmd(prefix);

  cmd+="nuke "+id;
  socket.send_data(cmd);
}

void Send_Command::send_smite(const string id)
{
  string cmd(prefix);

  cmd+="smite "+id;
  socket.send_data(cmd);
}

void Send_Command::send_mute(const string id)
{
  string cmd(prefix);

  cmd+="mute "+id;
  socket.send_data(cmd);
}

void Send_Command::send_ban(const string id,const string time)
{
  string cmd(prefix);

  cmd+="ban "+id+" "+time;
  socket.send_data(cmd);
}

void Send_Command::stop_send()
{
  socket.close_socket();
}
